package com.ctu.gzero.properties
{
	public class StringProperty extends Property
	{
		public function StringProperty(name:String, value:String)
		{
			super(name, value);
		}
		
		override public function hash(obj:Object, code:uint):uint
		{
			return doHash(obj as String, code);
		}
		
		public static function doHash(str:String, code:uint):uint
		{
			var _len:uint = str.length;
			var _u:uint = code;
			
			var _i:uint = 0;
			
			while(i < (_len/2))
			{
				_u = UintProperty.doHash( (str.charCodeAt(2*i)<<16)^(str.charCodeAt(2*i+1)),_u);
				_i++;	
			}
			
			if( (_len%2)==0)
			{
				_u = UintProperty.doHash(str.charCodeAt(_len-1), code);
			}
			
			return _u;
			
		}
		
	}
}